#ifndef _WORK_CONTEXT_49961FA3_0D06_4429_BCD0_251CFAAFE7AD_
#define _WORK_CONTEXT_49961FA3_0D06_4429_BCD0_251CFAAFE7AD_
#include <map>
#include "base/threading/non_thread_safe.h"
#include "proxy.h"
#include "work_thread.h"

class DownloadChannel;

/**
 * DLL工程的上下文管理:实现/提供暴露出去的接口
 */
class WorkContext : public IWorkProvider,
	                  public base::NonThreadSafe,
										public WorkThread::Delegate {
public:
	WorkContext();
	~WorkContext();
  // IWorkProvider
	virtual bool Init();
	virtual void Cleanup();
	virtual IDownloadProxy* GetDownload() const;

	// WorkThread::Delegate
	virtual void OnInit(WorkThread* thr);
	virtual void OnCleanup(WorkThread* thr);

private:
	scoped_ptr<WorkThread>          thread_;
	scoped_ptr<DownloadChannel>     download_channel_;
};

#endif//_WORK_CONTEXT_49961FA3_0D06_4429_BCD0_251CFAAFE7AD_